import React, { Component, PropTypes } from 'react'


class MyOrderTitle extends Component{
    render(){
        const {text, showBack} = this.props;
        let display = 'none';
        if(showBack === true) {
            display = '';
        }
        return (
            <div className="MyOrderTitle"> <button style={{display: display}} className="back" onClick={this._Click.bind(this)}></button>{text} </div>
        )
    }
    _Click(){
        this.context.router.goBack();
    }
}

MyOrderTitle.propTypes = {
    text: PropTypes.string.isRequired,
    showBack: PropTypes.bool.isRequired
}
MyOrderTitle.contextTypes = {
    router:React.PropTypes.object
}

export default MyOrderTitle